<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>添加带文字的li</title>
	<script type="text/javascript">
        window.onload = function(){
            var oTxt = document.getElementById('txt');
        	var oBtn = document.getElementById('btn1');
        	var oUl = document.getElementById('ul1');

        	oBtn.onclick = function(){
        		//创建元素
        		var oLi = document.createElement('li');

                oLi.innerHTML = oTxt.value;

        		//父级.appendChild(子节点)：往xx父级元素下添加xx子节点
        		oUl.appendChild(oLi);
        	}
        }
	</script>
</head>
<body>
    <input id="txt" type="text" value="" />
    <input id="btn1" type="button" value="创建li" />
	<div>
		<ul id="ul1"></ul>
	</div>
</body>
</html>